package me.zhengjie.inter.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.zhengjie.annotation.Log;
import me.zhengjie.annotation.rest.RepeatSubmit;
import me.zhengjie.business.domain.Order;
import me.zhengjie.business.domain.Snry;
import me.zhengjie.business.service.OrderService;
import me.zhengjie.business.service.YbryService;
import me.zhengjie.business.service.dto.SnryQueryCriteria;
import me.zhengjie.inter.service.MpSnryService;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author xiahongbo
 * @date 2022-07-10
 **/
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "移动端上门护理")
@RequestMapping("/mp/smhl")
public class MpHlController {

    private final MpSnryService mpSnryService;
    private final YbryService ybryService;

    private final OrderService orderService;

    @PostMapping(value = "/startHl")
    @Log("移动端开始护理")
    @ApiOperation("移动端开始护理")
    @RepeatSubmit
    public ResponseEntity<Object> startHl(@Validated @RequestBody Order resources) {
        log.info("移动端[/mp/smhl - post] ");
        orderService.makeJzdj(resources);
        return new ResponseEntity<>(PageUtil.toMpContent(new HashMap<String,Object>()), HttpStatus.CREATED);
    }


    @GetMapping(value = "/test")
    @ApiOperation("查询失能人员参保信息")
    public ResponseEntity<Object> test(String sfzh) {
        orderService.test(sfzh);
        return new ResponseEntity<>(HttpStatus.OK);
    }
}
